]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Apply css foreground color to text as a PangoAttribute
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 24 Mar 2020 23:34:58 +0000 (00:34 +0100)
committerCarlos Garnacho <mrgarnacho@gmail.com>
Wed, 25 Mar 2020 11:18:30 +0000 (11:18 +0000)
Rely on the Pango renderer handling this properly, instead of tinting
the full ClutterText in the color specified through css.

Also set the caret color explicitly, since it used to be set as a side
effect of clutter_text_set_color(), but no longer is.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/850
src/st/st-private.c

index 3107a0cf2dcfad2b1d933809b4913761baf343d9..db18587c78ccbb833d42ba871bc31c05ebd666a4 100644 (file)
@@ -115,18 +115,23 @@ _st_set_text_from_style (ClutterText *text,
   StTextDecoration decoration;
   PangoAttrList *attribs = NULL;
   const PangoFontDescription *font;
+  PangoAttribute *foreground;
   StTextAlign align;
   gdouble spacing;
   gchar *font_features;
 
-  st_theme_node_get_foreground_color (theme_node, &color);
-  clutter_text_set_color (text, &color);
-
   font = st_theme_node_get_font (theme_node);
   clutter_text_set_font_description (text, (PangoFontDescription *) font);
 
   attribs = pango_attr_list_new ();
 
+  st_theme_node_get_foreground_color (theme_node, &color);
+  clutter_text_set_cursor_color (text, &color);
+  foreground = pango_attr_foreground_new (color.red * 255,
+                                          color.green * 255,
+                                          color.blue * 255);
+  pango_attr_list_insert (attribs, foreground);
+
   decoration = st_theme_node_get_text_decoration (theme_node);
   if (decoration)
     {